﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using RTW.OA.Models;
using RTW.DAL;
using RTW.Utils.Utils;

namespace RTW.OA.Servers
{
    public  class LoginServers
    {
        private readonly IRepository<user> usersRepository;
        public LoginServers()
        {
            usersRepository = new DapperRepository<user>();
        }

        //public bool Login(string name, string password)
        //{

        // var islogin= usersRepository.SqlWithParamsBool("select * from users where  USER_NO=@Name and USER_PWD =@PassWord ", new { Name = name, PassWord = DEncryptUtil.Md5Encrypt(password) });
        //    return islogin;
        //}

        public user Login(string name, string password)
        {

            var users = usersRepository.SqlWithParamsSingle("select * from users where  USER_NO=@Name and USER_PWD =@PassWord ", new { Name = name, PassWord = DEncryptUtil.Md5Encrypt(password) });
            return users;
        }



    }
}